<!--账号划拔记录页面-->
<template>
  <el-card shadow="never" class="aui-card--fill">
    <div>
      <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
        <el-form-item>
          <el-input v-model="dataForm.id" placeholder="请输入查询id" clearable></el-input>
        </el-form-item>
        <el-form-item prop="accountType">
          <ren-select v-model="dataForm.accountType" dict-type="account_type" placeholder="请选择账户类型"></ren-select>
        </el-form-item>
        <el-form-item prop="tradeType">
          <ren-select v-model="dataForm.tradeType" dict-type="trade_type" placeholder="请选择冻结状态"></ren-select>
        </el-form-item>
        <el-form-item prop="formId">
          <el-input v-model="dataForm.formId" type="number" placeholder="请输入业务编号" clearable></el-input>
        </el-form-item>
        <el-form-item prop="userId">
          <el-input v-model="dataForm.userId" type="number" placeholder="请输入用户ID" clearable></el-input>
        </el-form-item>
        <el-form-item>
          <el-button v-if="$hasPermission('api:userAccountTransaction:save')" type="primary"
                     @click="addOrUpdateHandle()">
            新增
          </el-button>
        </el-form-item>
        <el-form-item>
          <el-button v-if="$hasPermission('api:userAccountTransaction:delete')" type="danger" @click="deleteHandle()">
            删除
          </el-button>
        </el-form-item>
      </el-form>
      <el-table v-loading="dataListLoading" :data="dataList" stripe highlight-current-row
                @selection-change="dataListSelectionChangeHandle" @sort-change="dataListSortChangeHandle"
                style="width: 100%;">
        <el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
        <el-table-column prop="id" label="id" header-align="center" align="center" width="100" fixed></el-table-column>
        <el-table-column prop="userId" label="用户ID" header-align="center" align="center" width="100"></el-table-column>
        <el-table-column prop="formId" label="业务编号" header-align="center" align="center" width="100"></el-table-column>
        <el-table-column prop="tradeNum" label="交易数量" header-align="center" align="center" width="100"></el-table-column>
        <el-table-column prop="accountType" label="账户类型" header-align="center" align="center" sortable width="120">
          <template slot-scope="{row}">
            <el-tag v-if="row.accountType === 1" size="small" type="success">
              {{ $getDictLabel("account_type", row.accountType) }}
            </el-tag>
            <el-tag v-else size="small" type="info">{{
                $getDictLabel("account_type", row.accountType)
              }}
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="accountType" label="冻结状态" header-align="center" align="center" sortable width="120">
          <template slot-scope="{row}">
            <el-tag v-if="row.tradeType === 1" size="small" type="success">
              {{ $getDictLabel("trade_type", row.tradeType) }}
            </el-tag>
            <el-tag v-else size="small" type="info">{{
                $getDictLabel("trade_type", row.tradeType)
              }}
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="createDate" label="创建日期" header-align="center" align="center"></el-table-column>
        <el-table-column label="操作" fixed="right" header-align="center" align="center" width="300">
          <template slot-scope="scope">
            <el-link v-if="$hasPermission('api:userAccountTransaction:update')" type="primary"
                       @click="addOrUpdateHandle(scope.row.id)">修改
            </el-link>
            <el-link v-if="$hasPermission('api:userAccountTransaction:delete')" type="primary"
                       @click="deleteHandle(scope.row.id)">删除
            </el-link>
          </template>
        </el-table-column>

      </el-table>
      <el-pagination :current-page="page" :page-sizes="[10, 20, 50, 100]" :page-size="limit" :total="total"
                     layout="total, sizes, prev, pager, next, jumper" @size-change="pageSizeChangeHandle"
                     @current-change="pageCurrentChangeHandle">
      </el-pagination>
      <!-- 弹窗, 新增 / 修改 -->
      <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
    </div>

  </el-card>
</template>

<script>
import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './userAccountTransactionAddOrUpdate.vue'
export default {
  mixins: [mixinViewModule],
  data() {
    return {
      mixinViewModuleOptions: {
        getDataListURL: '/api/userAccountTransaction/page',
        getDataListIsPage: true,
        deleteURL: '/api/userAccountTransaction',
        deleteIsBatch: true
      },
      dataForm: {
        id: '',                         //id
        accountType:'',                 //账户类型：0业绩账户,1积分账户
        tradeType: '',                  //冻结状态：0冻结-可用，1冻结-提现，2冻结-帮扶
        formId: '',                     //业务编号
        tradeNum:'',                    //交易数量
        userId: ''                      //用户ID
      },
    }
  },
  components: {
    AddOrUpdate
  },
  created() {

  },
  methods: {}
}
</script>
